]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
search: Catch async function errors and log them unless cancelled
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Mon, 16 Feb 2026 20:29:10 +0000 (21:29 +0100)
committerMarge Bot <marge-bot@gnome.org>
Tue, 17 Feb 2026 14:00:14 +0000 (14:00 +0000)
In case a search function fails, we are not providing clear errors, thus
trace the errors when calling async functions from sync ones and when
catching errors.

Note that at the moment is unlikely to receive any cancelled error here,
since the remote search providers calls handle the error already, but we
still use `logErrorUnlessCancelled` instead of `logError` to be more future
proof or to cover the case in which some extension may throw a cancelled
error.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4080>

js/ui/search.js

index 361475e2f24dd9d3b32d2ed956e8c2bf1dd7645a..99b8725da6d699c4d6214b107f09a13c4de1cdf0 100644 (file)
@@ -15,6 +15,7 @@ import {ensureActorVisibleInScrollView} from '../misc/animationUtils.js';
 
 import {Highlighter} from '../misc/util.js';
 import {Spinner} from './animation.js';
+import {logErrorUnlessCancelled} from '../misc/errorUtils.js';
 
 const SEARCH_PROVIDERS_SCHEMA = 'org.gnome.desktop.search-providers';
 
@@ -274,7 +275,8 @@ const SearchResultsBase = GObject.registerClass({
                     resultId => this._addItem(this._resultDisplays[resultId]));
                 this._setMoreCount(this.provider.canLaunchSearch ? moreCount : 0);
                 this.show();
-            } catch {
+            } catch (e) {
+                logErrorUnlessCancelled(e);
                 this._clearResultDisplay();
             }
         }
@@ -511,7 +513,7 @@ class GridSearchResults extends SearchResultsBase {
             const laters = global.compositor.get_laters();
             this._updateSearchLater = laters.add(Meta.LaterType.BEFORE_REDRAW, () => {
                 delete this._updateSearchLater;
-                super.updateSearch(...args);
+                super.updateSearch(...args).catch(logErrorUnlessCancelled);
                 return GLib.SOURCE_REMOVE;
             });
         });
@@ -713,7 +715,8 @@ export const SearchResultsView = GObject.registerClass({
 
         this._providers.forEach(provider => {
             const previousProviderResults = previousResults[provider.id];
-            this._doProviderSearch(provider, previousProviderResults);
+            this._doProviderSearch(provider, previousProviderResults).catch(
+                logErrorUnlessCancelled);
         });
 
         this._updateSearchProgress();